//////////////////////////////////////
// Fast Container Library           //
// MIT License - Copyright (c) 2012 //
//////////////////////////////////////

#pragma once

#include <cassert>

#include "config.h"


FC_NAMESPACE_BEGIN

// Required to override by the user if FC_ENABLE_ASSERT is defined.
FC_API void assert_failure( const char* expression, const char* file, unsigned int line );

FC_NAMESPACE_END



//microsoft
#if defined(_MSC_VER)
	#define FC_PREFIX_ALIGN(n) __declspec(align(n))
	#define FC_POSTFIX_ALIGN(n)
	#define FC_ALIGN(T, value, n) __declspec(align(n)) T value
	#define FC_ALIGNOF __alignof
	#define FC_PACK
	#define FC_FORCE_INLINE __forceinline
	#define FC_NO_INLINE __declspec(noinline)

//gcc
#elif defined(__GNUC__)
	#define FC_PREFIX_ALIGN(n)
	#define FC_POSTFIX_ALIGN(n) __attribute__((aligned(n)))
	#define FC_ALIGN(T, value, n) T value __attribute__((aligned(n)))
	#define FC_ALIGNOF(x) __alignof__(x)
	#define FC_PACK __attribute__((packed))
	#define FC_FORCE_INLINE inline __attribute__((always_inline))
	#define FC_NO_INLINE __attribute__((noinline))

//intel
#elif defined(__ICL) || defined(__ICC)
	#define FC_PREFIX_ALIGN(n) __declspec(align(n))
	#define FC_POSTFIX_ALIGN(n)
	#define FC_ALIGN(T, value, n) __declspec(align(n)) T value
	#define FC_ALIGNOF __alignof
	#define FC_PACK
	#define FC_FORCE_INLINE __forceinline
	#define FC_NO_INLINE __declspec(noinline)

#endif


#define FC_DEFAULT_ALIGN sizeof(void*)

#if defined(__GNUC__)
	#define FC_LIKELY(x) __builtin_expect((x), 1)
	#define FC_UNLIKELY(x) __builtin_expect((x), 0)
#else
	#define FC_LIKELY(x) (x)
	#define FC_UNLIKELY(x) (x)
#endif


FC_NAMESPACE_BEGIN

typedef unsigned int	size_t;
typedef int				ptrdiff_t;

#if defined(_MSC_VER)
	typedef __int32				int32_t;
	typedef unsigned __int32	uint32_t;
	typedef __int64				int64_t;
	typedef unsigned __int64	uint64_t;
#else
	typedef int					int32_t;
	typedef unsigned int		uint32_t;
	typedef long long			int64_t;
	typedef unsigned long long	uint64_t;
#endif


FC_NAMESPACE_END


